package com.example.demo.Service.lmp;

import com.example.demo.Dto.AiOrderQueryDto;
import com.example.demo.Service.AiService;
import com.example.demo.Util.AiUtil;
import com.example.demo.Util.ThreadLocallUtil;
import com.example.demo.VO.OrderInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class AiServiceImp implements AiService {
    private final AiUtil aiUtil;
    @Override
    public List<OrderInfoVo> getOrders(AiOrderQueryDto aiOrderQueryDto) {
        if (aiOrderQueryDto.getMaxResultCount()==null){
            List<OrderInfoVo> chat = aiUtil.chat(String.valueOf(ThreadLocallUtil.getUser().getUserId()), aiOrderQueryDto.getQueryContent());
            return chat;
        }
        return aiUtil.chat(String.valueOf(ThreadLocallUtil.getUser().getUserId()), aiOrderQueryDto.getQueryContent(), String.valueOf(aiOrderQueryDto.getMaxResultCount()));
    }

    @Override
    public String getChat(String chatContent) {
        return aiUtil.chat2(String.valueOf(ThreadLocallUtil.getUser().getUserId()),chatContent);
    }
}
